package org.brain.bean;

import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.SessionScoped;
import javax.faces.model.SelectItem;

import org.brain.dbo.DBOperate;
import org.brain.pojos.Documenttype;

@ManagedBean(name="documentType")
@SessionScoped
public class documentTypeBean {
	
	public List<SelectItem> doccumentTypes = new ArrayList<SelectItem>();
	public String typeId;
	
	public void loadDocumentType()
	{
		doccumentTypes.clear();
		List<Documenttype> type = DBOperate.search("Documenttype");
		for(Documenttype doc :type)
		{
			doccumentTypes.add(new SelectItem(doc.getTypeid(), doc.getTypename()));
		}
	}
	
	public List<SelectItem> getDoccumentTypes() {
		loadDocumentType();
		return doccumentTypes;
	}



	public void setDoccumentTypes(List<SelectItem> doccumentTypes) {
		this.doccumentTypes = doccumentTypes;
	}



	public String getTypeId() {
		return typeId;
	}
	public void setTypeId(String typeId) {
		this.typeId = typeId;
	}
	
}
